Next: @encode, Up: Type encoding [Contents][Index]

#### 8.3.1 Legacy type encoding

Unfortunately, historically GCC used to have a number of bugs in its encoding code. The NeXT runtime expects GCC to emit type encodings in this historical format (compatible with GCC-3.3), so when using the NeXT runtime, GCC will introduce on purpose a number of incorrect encodings:

- the read-only qualifier of the pointee gets emitted before the ’^’. The read-only qualifier of the pointer itself gets ignored, unless it is a typedef. Also, the ’r’ is only emitted for the outermost type.
- 32-bit longs are encoded as ’l’ or ’L’, but not always. For typedefs, the compiler uses ’i’ or ’I’ instead if encoding a struct field or a pointer.
- `enum`s are always encoded as ’i’ (int) even if they are actually unsigned or long.

In addition to that, the NeXT runtime uses a different encoding for bitfields. It encodes them as `b` followed by the size, without a bit offset or the underlying field type.